package com.shop.cereshop.app.param.product;

import com.shop.cereshop.commons.domain.common.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * @description: 商品搜索参数
 * @author zdd
 * @date 2025/10/21 22:10
 * @version 1.0
 */
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SearchProductParam", description = "商品搜索参数")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SearchProductParam extends PageParam implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "搜索内容")
    private String keyword;

    @ApiModelProperty(value = "店铺id")
    private Long shopId;

    @ApiModelProperty(value = "店铺类型：0-全部 1-同城服务(到店用) 2-线上商城(电商购) 3-同城配送(同城送)")
    private Integer shopType;

    @ApiModelProperty(value = "城市编码")
    private String cityCode;

    @ApiModelProperty(value = "筛选条件 (0-综合 1-销量 2-最新 3-价格升序 4-价格降序)")
    private Integer sortType;

    @ApiModelProperty(value = "分类id")
    private Long classifyId;

//    @ApiModelProperty(value = "用户点位(经度,纬度，如 114.293589,30.597117)")
//    private String location;

    @ApiModelProperty(value = "用户ID")
    private Long buyerUserId;


    public void setKeyword(String keyword) {
        if (StringUtils.isNotBlank(keyword) && keyword.length() > 40) {
            this.keyword = keyword.substring(0, 40);
        } else {
            this.keyword = keyword;
        }
    }


}
